{% extends "base.html" %}

{% block title %}登录 - 云水禅心居{% endblock %}

{% block content %}
<div class="container">
    <div class="auth-form">
        <h2>登录</h2>
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category }}">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        <form method="POST">
            {{ form.hidden_tag() }}
            <div class="wave-group">
                {{ form.username(class="input", required="required") }}
                <span class="bar"></span>
                <label class="label">
                    {% for char in '用户名' %}
                    <span class="label-char" style="--index: {{ loop.index0 }}">{{ char }}</span>
                    {% endfor %}
                </label>
                {% for error in form.username.errors %}
                    <span class="error-message">{{ error }}</span>
                {% endfor %}
            </div>
            <div class="wave-group">
                {{ form.password(class="input", required="required") }}
                <span class="bar"></span>
                <label class="label">
                    {% for char in '密码' %}
                    <span class="label-char" style="--index: {{ loop.index0 }}">{{ char }}</span>
                    {% endfor %}
                </label>
                {% for error in form.password.errors %}
                    <span class="error-message">{{ error }}</span>
                {% endfor %}
            </div>
            {{ form.submit(class="btn btn-primary") }}
        </form>
        <p class="mt-3">还没有账号？<a href="{{ url_for('register') }}">立即注册</a></p>
        <p class="mt-2">忘记密码？<a href="{{ url_for('password_reset') }}">修改密码</a></p>
    </div>
</div>
{% endblock %} 